<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="/static/layui/css/layui.css">
  <link rel="stylesheet" href="/static/css/admin/admin.css">
  <script src="/static/layui/layui.js"></script>
  <title>${title ?! '后台管理'}</title>
</head>
<body>
<header class="header-nav">
  <ul class="navbar-nav navbar-nav-right">
    <li>
      <a href="/index" target="_blank">
        <i class="layui-icon layui-icon-website"></i>
        <span class="font-yy">查看站点</span>
      </a>
    </li>
    <li>
      <a id="logout">
        <i class="layui-icon layui-icon-return"></i>
        <span class="font-yy">退出</span>
      </a>
    </li>
  </ul>
</header>

<aside class="aside">
  <div class="aside-top">
    <h2 class="font-yy">
      <i class="layui-icon-star-fill layui-icon"></i>
      <span>奋斗实验社区</span>
    </h2>
  </div>
  <div class="aside-user">
    <div class="image all-center">
      <img src="${user.icon ? user.icon : '/static/img/pk.jpg'}">
      <div class="font-yy">
        <span><span id="hello">上午好：</span>${user.name?user.name:user.username}</span>
      </div>
    </div>
  </div>
  <ul class="aside-nav flex font-yy">
    <li class="nav-item ${index}">
      <a href="/admin/index">
        <i class="layui-icon layui-icon-engine"></i>仪表盘
      </a>
    </li>
    <li class="nav-item ${users}">
      <a href="/admin/users">
        <i class="layui-icon layui-icon-user"></i>用户管理
      </a>
    </li>
    <li class="nav-item ${video}">
      <a href="/admin/videotag">
        <i class="layui-icon layui-icon-tabs"></i>视频分类
      </a>
    </li>
    <li class="nav-item ${audit}">
      <a href="/admin/audit">
        <i class="layui-icon layui-icon-search"></i>视频审核
      </a>
    </li>
    <li class="nav-item ${imgs}">
      <a href="/admin/imgs">
        <i class="layui-icon layui-icon-carousel"></i>主页大图管理
      </a>
    </li>
    <li class="nav-item ${count}">
      <a href="/admin/count">
        <i class="layui-icon layui-icon-chart"></i>平台统计
      </a>
    </li>
  </ul>
</aside>

<script>
  var h = new Date().getHours();
  if (h >= 12) {
    document.getElementById('hello').innerText = '下午好：';
  }

  function parseData(res) {
    return {
      "code": res.code,
      "msg": res.msg,
      "count": (res.payload ? res.payload.totalRows : 0),
      "data": (res.payload ? res.payload.rows : [])
    };
  }

  document.getElementById('logout').onclick = function (ev) {
    var xhr = new XMLHttpRequest();
    xhr.open('post', '/user/logout', true);
    xhr.onload = function (ev1) {
      location.href = '/login';
    };
    xhr.send();
  }
</script>

<article class="content-body">
